<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var message="Hello";

        window.onload=function(){
            var s1=document.getElementById("s1");
            var i1=document.getElementById("i1");

            s1.innerHTML=message;
            i1.value=message;

            i1.oninput=function(){
                message=i1.value;
                s1.innerHTML=message;
            }
        }

    </script>
</head>
<body>
    <span id="s1"></span><br/>
    <input type="text" id="i1"/>
</body>
</html>